//
// Created by Administrator on 2021/10/20.
//
#include <vector>
#include <iostream>

using namespace std;

class Solution {
public:
    int maxAscendingSum(vector<int> &nums) {
        int sum = nums[0], ans = nums[0];
        for (int i = 1; i < nums.size(); ++i) {
            if (nums[i] > nums[i - 1]) {
                sum += nums[i];
            } else {
                sum = nums[i];
            }
            ans = max(ans, sum);

        }
        return ans;
    }
};

int main() {
    vector<int> nums{10, 20, 30, 5, 10, 50};
    Solution solution;
    cout << solution.maxAscendingSum(nums) << endl;
    return 0;
}
